package com.woniuxy.aop;

import org.aspectj.lang.JoinPoint;
import org.aspectj.lang.annotation.After;
import org.aspectj.lang.annotation.Aspect;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import com.woniuxy.mapper.LogMapperAop;

@Aspect
@Component
public class ProductAop {

	@Autowired
	LogMapperAop logMapper;
	
	//addCollection切点的,返回通知
	 @After("execution(* com.woniuxy.mapper.ProductMapper..findProductById(..))")
	public void findProductById(JoinPoint point) {//访问了p_id商品
		Object[] args = point.getArgs();
		int p_id=(int) args[0];
		System.out.println("p_id");
		int u_id=(int) args[1];
		if(u_id!=0) { //如果用户登录了，就显示谁谁访问量。。。
			logMapper.findProductById(p_id, u_id);
		}
		
	}
}
